//
//  CellOfCityCellOfNot_miss.m
//  FreeTravel
//
//  Created by 徐康 on 16/9/5.
//  Copyright © 2016年 KX. All rights reserved.
//
#import "Masonry.h"
#import "UIImageView+WebCache.h"
#import "CellOfCityCellOfNot_miss.h"
@interface CellOfCityCellOfNot_miss ()
@property (nonatomic, strong) UIImageView *imageViewOfPic_url;
@property (nonatomic, strong) UILabel *labelOfName;
@property (nonatomic, strong) UILabel *labelOfDesc ;
@property (nonatomic, strong) UIView *grayBlock;
@end
@implementation CellOfCityCellOfNot_miss
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imageViewOfPic_url = [[UIImageView alloc]init];
        self.labelOfDesc = [[UILabel alloc]init];
        self.labelOfName = [[UILabel alloc]init];
        self.grayBlock = [[UIView alloc]init];
        [self.contentView addSubview:self.grayBlock];
        [self.contentView addSubview:self.imageViewOfPic_url];
        [self.contentView addSubview:self.labelOfName];
        [self.contentView addSubview:self.labelOfDesc];
    }
    return self;
    
}
- (void)layoutSubviews{
    [super layoutSubviews];
    [self.imageViewOfPic_url mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(self.contentView);
        make.height.mas_offset(150);
    }];
    [self.labelOfName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.imageViewOfPic_url);
        make.width.mas_offset(50);
    }];
    self.labelOfName.textColor = [UIColor whiteColor];
    self.labelOfName.font = [UIFont fontWithName:@"Helvetica-Bold" size:15.f];
    self.labelOfName.textAlignment = NSTextAlignmentCenter;
    [self.labelOfDesc mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.mas_left).mas_offset(20);
        make.right.equalTo(self.contentView.mas_right).mas_offset(-20);
        make.top.equalTo(self.imageViewOfPic_url.mas_bottom).mas_offset(10);
        make.bottom.equalTo(self.grayBlock.mas_top).mas_offset(10);
    }];
    self.labelOfDesc.textColor = [UIColor grayColor];
    self.labelOfDesc.font = [UIFont systemFontOfSize:12];
    [self.grayBlock mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.equalTo(self.contentView);
        make.height.mas_offset(4);
    }];
    self.grayBlock.backgroundColor = [UIColor lightGrayColor];
}
- (void)setModel:(ModelOfNot_missCommendScenicSpotView *)model{
    _model = model;
    self.labelOfDesc.text = model.desc;
    self.labelOfName.text = model.name;
    [self.imageViewOfPic_url sd_setImageWithURL:[NSURL URLWithString:model.pic_url]];
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
